perm filename EMAIN1.2[EAL,HE] blob sn#708968 filedate 1983-05-03 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00003 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	{$NOMAIN	Editor: initialization routine }
C00004 00003	procedure editInit external
C00007 ENDMK
C⊗;
{$NOMAIN	Editor: initialization routine }

%include emain.hdr;

{ Externally defined routines from elsewhere: }

	(* From ALLOC *)
function newStatement: statementp;				external;

	(* From EAUX1A *)
procedure out1Line(line,start,length: integer);			external;

	(* From EAUX2C *)
procedure displayLines(var pfrom: integer);			external;

	(* From PP *)
procedure relLine(l: linerecp);					external;
procedure ppLine; 						external;
procedure ppOutNow; 						external;
procedure ppChar(ch: ascii); 					external;
procedure pp5(ch: c5str; length: integer); 			external;
procedure pp10(ch: cstring; length: integer); 			external;
procedure pp10L(ch: cstring; length: integer);			external;
procedure pp20(ch: c20str; length: integer); 			external;
procedure pp20L(ch: c20str; length: integer); 			external;
procedure ppInt(i: integer); 					external;
procedure ppReal(r: real); 					external;
procedure ppStrng(length: integer; s: strngp); 			external;

	(* From DISP *)
procedure showCursor(line,col: integer); 			external;
procedure outChar(line,col: integer; ch: ascii; bold: boolean); external;

procedure editInit; external;
procedure editInit;
var i:integer;
 begin
 setCursor := true;
 cursorLine := 2;
 lineNum := 1;
 topDline := 0;
 botDline := 0;
 displayLines(lineNum);			(* show first window *)
 pp10L('Ready.    ',6); ppLine;
 end;

procedure eMain1Aux(oc: integer); external;
procedure eMain1Aux;
 var ch: ascii;
 begin
 showCursor(cursorLine-topDline-firstDline+2,1);	(* shift cursor *)
 if cursorLine <> oc then
   begin
   if smartTerminal then
     begin
     outChar(cursorLine-topDline-firstDline+2,1,'>',false); (* other cursor *)
     if (topDline+firstDline-1 <= oc) and
	(oc <= topDline+firstDline+dispHeight-2) then
       with lines[oc-topDline+1]↑ do	(* for bad stmnts redisplay the "!" *)
	outChar(oc-topDline-firstDline+2,1,listing[start],false);
       showCursor(cursorLine-topDline-firstDline+2,1);	(* Move cursor there *)
     end
    else
     begin
     with lines[cursorLine-topDline+1]↑ do		(* show ">" cursor *)
      begin
      ch := listing[start];			(* remember first char of line *)
      listing[start] := '>';			(* display cursor *)
      out1Line(cursorLine-topDline-firstDline+2,start,length);
      listing[start] := ch;			(* restore things *)
      end;
     if (topDline+firstDline-1 <= oc) and
	(oc <= topDline+firstDline+dispHeight-2) then
       with lines[oc-topDline+1]↑ do	(* for bad stmnts redisplay the "!" *)
	out1Line(oc-topDline-firstDline+2,start,length);
     end
   end;
 end;